<template>
    <el-select placeholder="请选择优惠券" multiple filterable clearable remote :remote-method="initify" :loading="loading"
        class="w-100">
        <el-option v-for="item in options" :key="item.id" :label="item.title" :value="item.id" />
    </el-select>
</template>
<script>
export default {
    data() {
        return {
            loading: false,
            options: []
        };
    },
    created() {
        this.initify();
    },
    methods: {
        initify(title) {
            this.loading = true;
            this.$http.useGet("app/ycMassage/admin/Coupon/index", {
                title
            }).then(res => {
                this.options = res.data.data.map(item => {
                    return {
                        id: item.id,
                        title: item.title
                    }
                })
            }).finally(() => {
                this.loading = false;
            });
        },
    },
};
</script>
<style lang="scss" scoped>
.w-100 {
    width: 50vw;
}
</style>